<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>变量覆盖-04</title>
</head>
<body>
<h1>仔细思考：拿到flag,flag是一首歌名！</h1>
<a href="source.php" target="_blank"><h2>查看源码</h2></a>
</body>
</html>

<?php
include'flag.php';
$yds = "dog";
$is = "cat";
$handsome = 'yds';

foreach($_GET as $x => $y){
    $$x = $$y;
}

foreach($_GET as $x => $y){
    if(@$_GET['flag'] === $x && $x !== 'flag'){
        exit($handsome);
    }
}

if(!isset($_GET['flag']) && !isset($_POST['flag'])){
    exit($yds);

}

if(@$_POST['flag'] === 'flag'  || @$_GET['flag'] === 'flag'){
    exit($is);
}

echo "the flag is: ".$flag;
?>
